#include "StdAfx.h"
#include "DepthContour.h"

DepthContour::DepthContour(void)
{
}

DepthContour::~DepthContour(void)
{
}

Node* DepthContour::LoadDepthContour( const string& s57file, const string& shpDir )
{
	string shpFile(shpDir);
	shpFile.append("/DEPCNT.shp");

	Node* node = loadShpFileAndSetColor(shpFile, 0.52f, 0.51f, 1.0f, 1.0f);
	if (node)
	{
		return node;
	}

	char** cmd = new char*[5];
	cmd[0] = "ogr2ogr";
	cmd[1] = "-skipfailure";
	cmd[2] = new char[100];
	cmd[3] = new char[100];
	cmd[4] = "DEPCNT"; 
	strcpy(cmd[2], shpDir.c_str());
	strcpy(cmd[3], s57file.c_str());

	ogr2ogr(5, cmd);

	delete [] cmd[2];
	delete [] cmd[3];
	delete [] cmd;

	node = loadShpFileAndSetColor(shpFile, 0.52f, 0.51f, 1.0f, 1.0f);
	return node;
}
